package lec06.pm;

import java.io.File;
import java.util.Arrays;
import java.util.Vector;

public class FListDemo {
	public static void listAllFiles(String path) {
		File file = new File(path);
		if (file.isDirectory()) {
			String fs[] = file.list();
			for (String f : fs) {
				listAllFiles(path + "\\" + f);
			}
		} else {
			System.out.println(file.getAbsolutePath());
		}
	}
	public static Vector<String> getListAllFiles(String path) {
		Vector<String> v=new Vector<String>();
		File file = new File(path);
		if (file.isDirectory()) {
			String fs[] = file.list();
			for (String f : fs) {
				{
				v.addAll(getListAllFiles(path + "\\" + f));						
				}
			}
		} else {
			v.add(file.getAbsolutePath());
		}
		return v;
	}

	public static void main(String[] args) {
		//listAllFiles("src");
		Vector<String> lists=getListAllFiles("src");
		for(String s:lists)
			System.out.println(s);
		System.out.println(lists.size());
	}
}
